#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
using namespace std;
typedef long long ll;
int main() {
	ll ask;
	while (cin>>ask) {
		ll tmp=sqrt(2*ask);
		if (ask==1) cout<<0<<endl;
		else if (ask==2) cout<<1<<endl;
		else if (ask==4) cout<<1<<endl;
		else if (tmp*(tmp+1)==2*ask) {
			cout<<1<<endl;
		} 
		else cout<<2<<endl;
	}
	return 0;
} 
